package com.ontheroad.mysql.activity.service;

import cn.modoumama.service.base.impl.BaseServiceImpl;
import com.ontheroad.activity.model.ActivityJoinApplyModel;
import com.ontheroad.activity.model.ActivityModel;
import com.ontheroad.activity.service.ActivitJoinApplyService;
import com.ontheroad.mysql.activity.mapper.ActivityJoinApplyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by kedong on 2017/9/23 0023.
 */
@Service
@Transactional
public class ActivitJoinApplyServiceImpl extends BaseServiceImpl<ActivityJoinApplyModel, Integer> implements ActivitJoinApplyService {

    @Autowired
    private ActivityJoinApplyMapper mapper;

    @Autowired
    public void setMapper(ActivityJoinApplyMapper mapper) {
        setGenericMapper(mapper);
    }

    public List<ActivityModel> getMyActivity(Long userId) {
        return mapper.getMyActivity(userId);
    }

    @Override
    public Integer getJoinState(ActivityModel activity, Integer userId) {
        return mapper.getJoinState(activity.getId(), userId);
    }
}
